Skip to content

Conversation

@dpvreony
Copy link
Contributor

@dpvreony dpvreony commented Jan 16, 2026

This is a fairly fundamental change to MsBuild + Roslyn, so appreciate might want to take some time looking at it.

This changes DocFX to use Microsoft.Build.Locator to find the latest applicable version of the .NET SDK or Visual Studio. So the TFM used for the docfx runtime will only find the latest version it can use. (for example the NET8 version complains if you try to scan a net10 project with it as it can only locate net8 etc.) Also added a ForceBuild for cases where some output is not tied to Roslyn, or DesignTime builds.

Fixes #10848, #10808, #10781, #10731, #10901

potentially sorts #10772 and the underlying error seen in #10840 (but not the actual piece about enabling binary logging, though that could be done via a Directory.Build.rsp file next to a project \ solution and the ForceBuild option)

also would give the answer "It just works as long as you use the right TFM (or latest) version of the DocFX runtime" to #8251

Thanks :)

@filzrev
Copy link
Collaborator

filzrev commented Jan 16, 2026

docfx using Microsoft.CodeAnalysis.Workspaces.MSBuild package for metadata extractions.
And metadata extraction is executed on separated process.

Is registered MSBuild SDK on this PR is actually used for metadata extraction?

@dpvreony
Copy link
Contributor Author

dpvreony commented Jan 16, 2026

docfx using Microsoft.CodeAnalysis.Workspaces.MSBuild package for metadata extractions. And metadata extraction is executed on separated process.

Is registered MSBuild SDK on this PR is actually used for metadata extraction?

most the code remains the same for metadata, it's just the locator sets up MSBuild rather than it being included in the bin folder. the details are available in https://learn.microsoft.com/en-us/visualstudio/msbuild/find-and-use-msbuild-versions

i've tested metadata extraction using https://github.com/dpvreony/Vetuviem with the release version of docfx it fails to "build" the projects due to source generators being involved. with this PR:

  • NET8 and NET9 versions of the docfx tool complain about being unable to Target NET10
  • NET10 works and produces full metadata, including for generated code.

i'll look at the other adjustments above

@filzrev filzrev requested a review from yufeih January 24, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DocFX bundles roslyn rather than using the version from the SDK

2 participants